<template>
	<view class="detail">
		<view class="header">
			<image @click="back" class="icon" src="../../static/images/back.png" mode=""></image>
			<view class="title">{{detail.title}}</view>
			<view style="width: 40rpx;"></view>
		</view>
		<view class="con" v-html="detail.content"></view>
	</view>
</template>

<script>
	import {domains} from '../../config/domain.js'
	export default{
		data(){
			return{
				detail:[],
				id:0
			}
		},
		onLoad(e) {
			this.id = e.id
			this.getdetail()
		},
		methods:{
			getdetail(){
				let url = domains + 'api/news/info?id=' + this.id;
				let mytype = 'get';
				uni.request({
					url,
					method: mytype,
					header: {
						'content-type': 'application/x-www-form-urlencoded' ,//自定义请求头信息
						'Lang':uni.getStorageSync('lang'),
						'authorization':uni.getStorageSync('token')
					},
					success: res => {
						if(res.data.code == 0){
							this.detail = res.data.data
						}else{
							uni.showToast({//提示
								icon:'none',
								title:res.data.msg
							})
						}
					},
					fail: (err) => {
						console.log(err)
					},
					complete: () => {
						setTimeout(function() {
							uni.hideLoading();
						}, 1000);
					}
				});
			},
			back(){
				uni.navigateBack()
			},
		}
	}
</script>

<style scoped>
*{
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}
.header{
	width: 100%;
	height: 100rpx;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 30rpx;
}
.icon{
	width: 40rpx;
	height: 40rpx;
}
.title{
	flex: 1;
	font-size: 32rpx;
	color: #000;
	margin: 0 20rpx;
	text-align: center;
}
.con{
	width: 100%;
	font-size: 28rpx;
	color: #000;
	padding: 0 30rpx;
	padding-bottom: 30rpx;
}
</style>